<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="__PUBLIC__/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="__PUBLIC__/css/my.css">
    <title>用户登录</title>
</head>
<body>
<body class="adminlogin">

<div class="conatiner mt50">
    <div class="clearfix mt50"></div>
    <h1 class="text-center mt50">用  户 登 录</h1>
    <hr>

    <form onsubmit="return false;" class="form-horizontal col-md-4 col-md-offset-4">

        <div class="form-group">
            <div class="col-md-12">
                <input type="text" name="username" class="form-control input-lg" placeholder="请输入用户名..">
            </div>
        </div>

        <div class="form-group">
            <div class="col-md-12">
                <input type="password" name="passwd" class="form-control input-lg" placeholder="请输入密码">
            </div>
        </div>


        <div class="form-group">
            <div class="col-md-12">
                <div class="pull-left">
                    <input type="text" name="vcode" class="form-control" placeholder="验证码">
                </div>
                <div class="pull-right">
                    <img src="{:U('User/yzm')}" title="点 我 刷 新" style="cursor:pointer" onclick="this.src=this.src+'?i='+Math.random()" class="pull-right verify">
                </div>
            </div>
        </div>

        <div class="form-group">
            <div class="col-md-12">
                <button class="btn btn-primary btn-lg btn-block" onclick="login()">登了个录</button>
            
            </div>
            <a href="{:U('User/reg')}">前去注册</a>
            <a class="pull-right " data-toggle="modal" href="#myModal-2">忘记密码</a>
        </div>

    </form>
</div><!-- END container -->
<div class="modal fade" id="myModal-2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">输入您注册的邮箱</h4>
            </div>
            <div class="modal-body">
                <form role="form" class="form-inline">
                    <div class="form-group">
                        <label for="email" class="sr-only">邮箱地址</label>
                        <input id="email" type="email" placeholder="输入邮箱" class="form-control sm-input">
                    </div>
                    <button class="btn btn-primary" type="submit">确认</button>
                </form>

            </div>

        </div>
    </div>
</div>

<!-- 此处引入jQuery -->
<script src="__PUBLIC__/js/jquery.min.js"></script>
<!-- bootstrap.min.js必须放在JQ后面 -->
<script src="__PUBLIC__/js/bootstrap.min.js"></script>
<script>


    function login(){
        var username=$("input[name='username']").val();
        var passwd =$("input[name='passwd']").val();
        var vcode = $("input[name='vcode']").val();
        $.ajax({
            type:'post',
            url:"{:U('User/login1')}",
            data:{username:username,passwd:passwd,vcode:vcode},

            success:function(data){
                if(data.status == 0){
                    alert("登录成功");
                    window.location.href="{:U('Index/index')}";

                }else{
                    alert(data.message);
                };

            }
        })
    }
    $('.form-inline').submit(function () {
        $.ajax({
            type:'post',
            url:"{:U('User/forgetPasswd')}",
            data:{'email':$('#email').val()},
            success:function(data){
                $('#myModal-2').modal('hide');
                alert(data.message);
            }
        })
        return false;
    });

</script>
</body>
</html>